package com.neuedu.yyzx.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.neuedu.yyzx.common.CommonResult;
import com.neuedu.yyzx.entity.UserRole;
import com.neuedu.yyzx.service.IUserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 用户角色 前端控制器
 * </p>
 *
 * @author dya
 * @since 2021-05-10
 */
@RestController
@RequestMapping("//userRole")
public class UserRoleController {

    @Autowired
    IUserRoleService userRoleService;


    @RequestMapping("/getByUserId")
    CommonResult getByRoleId(Integer id) {
        QueryWrapper queryWrapper=new QueryWrapper();
        queryWrapper.eq("user_id",id);
        return CommonResult.success(userRoleService.getOne(queryWrapper));
    }


    @RequestMapping("/save")
    CommonResult save(UserRole userRole) {

        return CommonResult.success(userRoleService.saveOrUpdate(userRole));
    }
}
